import {
	createRouter,
	createWebHistory,
	RouterView,
} from 'vue-router'
import {
	h,
	resolveComponent,
} from 'vue'
import NProgress from 'nprogress'

const routes = [{
	path: '/',
	name: 'Layout',
	component: () => import('@/layout/index.vue')
}, {
	path: '/Error',
	name: 'Error',
	meta: {
		title: '404',
	},
	component: () => import('@/views/Error.vue')
}, {
	path: '/:pathMatch(.*)',
	redirect: '/Error',
}]
const router = createRouter({
	history: createWebHistory(),
	routes
})
router.beforeEach((to, from, next) => {
	NProgress.start()
	next()
})
router.afterEach(transition => {
	NProgress.done();
});
export default router
